<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>

		<!--[if lt IE 9]>
    	<script src="../js/jquery-1.11.3.js"></script>    
		<![endif]-->
		<!--[if gte IE 9]><!-->
		<script src="../js/jquery-3.1.1.js"></script>
		<!--<![endif]-->
		<script>
			$(document).ready(function() {
				$("button").click(function() {

						url = "http://127.0.0.1:8020/class3/jquery/text/new.txt";

						var xmlhttp;
						if(window.XMLHttpRequest) {
							//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
							xmlhttp = new XMLHttpRequest();
						} else {
							// IE6, IE5 浏览器执行代码
							xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlhttp.onreadystatechange = function() {
							if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {

								$("#div1").html(xmlhttp.responseText);
							}
						}
						xmlhttp.open("GET", url, true);
						xmlhttp.send();
					
				});
			});
		</script>
	</head>

	<body>
		<div id="div1">
			<h2>使用 jQuery AJAX 修改文本内容</h2></div>
		<button>获取其他内容</button>
	</body>

</html>